﻿using System;
using System.Collections.Generic;
using Firefly.Framework.Windows;
using Firefly.Framework.Windows.ContentReaders;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler;

namespace Firefly.ContentPipeline.Windows
{
    [ContentTypeWriter]
    public class ThemeContentWriter : ContentTypeWriter<Theme>
    {
        protected override void Write(ContentWriter output, Theme value)
        {
            WriteTheme(output, value);
        }

        public override string GetRuntimeReader(TargetPlatform targetPlatform)
        {
            return typeof(ThemeContentReader).AssemblyQualifiedName;
        }

        internal static void WriteTheme(ContentWriter output, Theme value)
        {
            output.WriteObject<Dictionary<string, Cursor>>(value.Cursors);
            output.WriteObject<Dictionary<String, Font>>(value.Fonts);
            output.WriteObject<StretchThemePart>(value.Form);
            output.WriteObject<StretchThemePart>(value.Button);
            output.WriteObject<StretchThemePart>(value.Textbox);
            output.WriteObject<ThemePart>(value.Toggle);
            output.WriteObject<ThemePart>(value.Scrollbar);
        }
    }
}
